package com.bxs.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bxs.global.JsonResult;
import com.bxs.mapper.RuleMapper;
import com.bxs.message.MessageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 检测规则管理
 */
@RestController
public class RuleController {
    @Autowired
    RuleMapper ruleMapper;

    @GetMapping("rule-list")
    public JsonResult getRules(){
        return JsonResult.success(ruleMapper.selectList(new QueryWrapper<>()));
    }


    @Autowired
    MessageUtils messageUtils;

    @GetMapping("test-email")
    public JsonResult test(){
        messageUtils.sendSimpleEmail("IDS 日志警告", "内容：主机可能正在遭受威胁", "bikexs@foxmail.com", "2591127480@qq.com");
        return JsonResult.success("success");
    }
}
